﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CadastroPessoaJuridica.aspx.cs" Inherits="SisVenda.Web.Restrito.CadastroPessoaJuridica" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript">
/*
* Corrige posição do calendar extender no IE (AjaxToolKit)
*/
function CorrigePosicaoCalendarIE(idElemento, alturaInput) {
    $('input[id*="tbxDataNasci_CalendarExtender"]').click(function() {
        ResistrarInterval($(this), alturaInput);
    });

    $('input[id*="tbxDataNasci_CalendarExtender"]').focus(function() {
        ResistrarInterval($(this), alturaInput);
    });
}

function ResistrarInterval(campo, alturaInput) {
    var intervalo = window.setInterval(function() {
        if ($(".ajax__calendar_container").is(":visible")) {
            $(".ajax__calendar_container").css('left', $(campo).position().left + 0);
            $(".ajax__calendar_container").css('top', $(campo).position().top + alturaInput);
            clearInterval(intervalo);
        }
    }, 50);
</script>

<asp:Panel ID="pnlConsultaCliente" runat="server" DefaultButton="btnLocalizarCliente" GroupingText="Localizar Pessoa Jurídica">
        <div>
        <table width="100%">
            <tr> 
                <td style="text-align: center; width: 40%">
                    <asp:Label ID="lblCNPJLocalizar" runat="server" Text="CNPJ:" />
                    <asp:RequiredFieldValidator ID="rfvCanalEntrada" runat="server" ControlToValidate="tbxCNPJLocalizar"
                        ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Canal">
                    </asp:RequiredFieldValidator>
                    <act:ValidatorCalloutExtender ID="rfvCanalEntrada_ValidatorCalloutExtender" runat="server"
                        Enabled="True" TargetControlID="rfvCanalEntrada">
                    </act:ValidatorCalloutExtender>
                    <asp:TextBox ID="tbxCNPJLocalizar" runat="server" SkinID="CpfCnpj"></asp:TextBox>
                    <act:MaskedEditExtender ID="tbxCNPJLocalizar_MaskedEditExtender" runat="server" 
                        CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder=""  SkinID="Cnpj"
                        CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                        CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                        TargetControlID="tbxCNPJLocalizar">
                    </act:MaskedEditExtender>
                    &nbsp;<asp:Button ID="btnLocalizarCliente" runat="server" 
                       SkinID="Pesquisar" ValidationGroup="Canal" Text="Pesquisar" 
                        onclick="btnLocalizarCliente_Click"/>
                </td>
            </tr>
        </table>
        </div>
</asp:Panel>
<asp:Panel runat="server" ID="pnlDados" Visible="false">
   <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
      <ContentTemplate>
        <asp:Panel ID="pnlDadosCliente" runat="server" GroupingText="Dados Pessoa Jurídica">
        <div>
           <table width="100%">
               <tr>     
                  <td>
                     <asp:Label ID="lbltbxRazaoSocial" Text="Razão Social:" runat="server" />
                      <asp:RequiredFieldValidator ID="rfvtbxRazaoSocial" runat="server" ControlToValidate="tbxRazaoSocial"
                       ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                      </asp:RequiredFieldValidator>
                      <act:ValidatorCalloutExtender ID="rfvtbxRazaoSocial_ValidatorCalloutExtender" runat="server"
                        Enabled="True" TargetControlID="rfvtbxRazaoSocial">
                         </act:ValidatorCalloutExtender>
                          <br />
                         <asp:TextBox ID="tbxRazaoSocial" runat="server" SkinID="Nome"></asp:TextBox>

                  </td>
                  <td>
                     <asp:Label ID="lblNomeFatasia" Text="Nome Fantasia:" runat="server" />
                      <asp:RequiredFieldValidator ID="rfvNomeFatasia" runat="server" ControlToValidate="tbxNomeFatasia"
                       ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                      </asp:RequiredFieldValidator>
                      <act:ValidatorCalloutExtender ID="rfvNomeFatasia_ValidatorCalloutExtender" runat="server"
                        Enabled="True" TargetControlID="rfvNomeFatasia">
                         </act:ValidatorCalloutExtender>
                         <br />
                         <asp:TextBox ID="tbxNomeFatasia" runat="server" SkinID="Nome"></asp:TextBox>
                  </td>
                  <td>
                        <asp:Label ID="lblCNPJ" Text="CNPJ:" runat="server" />
                         <asp:RequiredFieldValidator ID="rfvCNPJ" runat="server" ControlToValidate="tbxCNPJ"
                         ErrorMessage="CNPJ é Obrigatório." ToolTip="CNPJ é Obrigatório." ValidationGroup="Geral">
                         </asp:RequiredFieldValidator>
                         <act:ValidatorCalloutExtender ID="rfvCNPJ_ValidatorCalloutExtender" runat="server"
                         Enabled="True" TargetControlID="rfvCNPJ">
                        </act:ValidatorCalloutExtender>
                        <br />
                        <asp:TextBox ID="tbxCNPJ" runat="server" AutoPostBack="True"
                         SkinID="CpfCnpj">
                         </asp:TextBox>
                        <act:MaskedEditExtender ID="tbxCNPJ_MaskedEditExtender" runat="server" 
                            CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                            CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                            CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                            TargetControlID="tbxCNPJ" SkinID="Cnpj">
                        </act:MaskedEditExtender>
                  </td>
                  <td>
                       <asp:Label ID="lblInscricao" Text="Inscrição Estadual:" runat="server" />
                         <asp:RequiredFieldValidator ID="rfvInscricao" runat="server" ControlToValidate="tbxInscricao"
                         ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral"></asp:RequiredFieldValidator>
                         <act:ValidatorCalloutExtender ID="rfvInscricao_ValidatorCalloutExtender" runat="server"
                         Enabled="True" TargetControlID="rfvInscricao">
                         </act:ValidatorCalloutExtender>
                       <br />
                       <asp:TextBox ID="tbxInscricao" runat="server" CssClass="largura150px"></asp:TextBox>
                      <act:MaskedEditExtender ID="tbxInscricao_MaskedEditExtender" runat="server" Enabled="True"
                       Mask="9{20}" SkinID="NumeroPositivo" TargetControlID="tbxInscricao">
                     </act:MaskedEditExtender>

                  </td>
               </tr>
           </table>
           <table width="100%">
               <tr>
                        <td>
                          <asp:Label ID="lblEndereco" runat="server" Text="Endereço:" />
                            
                            <asp:RequiredFieldValidator ID="rfvEndereco" runat="server" ControlToValidate="tbxEndereco"
                            ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                           </asp:RequiredFieldValidator>
                          <act:ValidatorCalloutExtender ID="rfvEndereco_ValidatorCalloutExtender" runat="server"
                          Enabled="True" TargetControlID="rfvEndereco">
                          </act:ValidatorCalloutExtender>
                          <br />
                            <asp:TextBox ID="tbxEndereco" runat="server" SkinID="Nome"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Label ID="lblnumero" runat="server" Text="N°:" />
                            
                            <asp:RequiredFieldValidator ID="rfvNumero" runat="server" ControlToValidate="tbxNumero"
                            ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                           </asp:RequiredFieldValidator>
                          <act:ValidatorCalloutExtender ID="rfvNumero_ValidatorCalloutExtender" runat="server"
                          Enabled="True" TargetControlID="rfvNumero">
                          </act:ValidatorCalloutExtender>
                          <br />
                            <asp:TextBox ID="tbxNumero" runat="server" SkinID="NumeroPequeno"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Label ID="lblBairro" runat="server" Text="Bairro:" />
                            
                            <asp:RequiredFieldValidator ID="rfvBairro" runat="server" ControlToValidate="tbxBairro"
                            ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                           </asp:RequiredFieldValidator>
                          <act:ValidatorCalloutExtender ID="rfvBairro_ValidatorCalloutExtender" runat="server"
                          Enabled="True" TargetControlID="rfvBairro">
                          </act:ValidatorCalloutExtender>
                          <br />
                            <asp:TextBox ID="tbxBairro" runat="server" SkinID="Nome"></asp:TextBox>
                        </td>
                        <td>
                           <asp:Label ID="lblUF" runat="server" Text="UF:" />
                            <br />
                            <asp:DropDownList ID="ddlUF" runat="server" DataSourceID="odsUF" 
                                DataTextField="uf_nome" DataValueField="uf_nome" SkinID="UF" 
                                AutoPostBack="True" onselectedindexchanged="ddlUF_SelectedIndexChanged">
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="odsUF" runat="server" 
                                OldValuesParameterFormatString="original_{0}" SelectMethod="ObterUF" 
                                TypeName="SisVenda.Web.Restrito.Fn.CadastroPessoaFisicaFn">
                            </asp:ObjectDataSource>
                           
                        </td>
                        <td>
                            <asp:Label ID="lblCidade" runat="server" Text="Cidade:" />
                            <br />
                            <asp:DropDownList ID="ddlCidade" SkinID="Cidade" runat="server" 
                                AutoPostBack="True" DataSourceID="odsCidade" DataTextField="cid_cidade" 
                                DataValueField="cid_id"></asp:DropDownList>

                            <asp:ObjectDataSource ID="odsCidade" runat="server" 
                                OldValuesParameterFormatString="original_{0}" SelectMethod="ObterCidadeUF" 
                                TypeName="SisVenda.Web.Restrito.Fn.CadastroPessoaFisicaFn">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="ddlUF" Name="nome" 
                                        PropertyName="SelectedValue" Type="String" />
                                </SelectParameters>
                            </asp:ObjectDataSource>

                        </td>
               </tr>
           </table>
           <table width="100%">
              <tr>
                 <td>
                     <asp:Label ID="lblcep"  Text="Cep:" runat="server"></asp:Label>
                     
                     <asp:RequiredFieldValidator ID="rfvCep" runat="server" ControlToValidate="tbxCep"
                         ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral"></asp:RequiredFieldValidator>
                         <act:ValidatorCalloutExtender ID="rfvCep_ValidatorCalloutExtender" runat="server"
                         Enabled="True" TargetControlID="rfvCep">
                         </act:ValidatorCalloutExtender>
                         <br />
                     <asp:TextBox ID="tbxCep" runat="server" SkinID="CEP"></asp:TextBox>
                 </td> 
                 <td>
                     <asp:Label ID="lblTipoTel" runat="server" Text="Tipo Telefone:"></asp:Label>
                     <br />
                     <asp:DropDownList ID="ddlTipoTel" runat="server" SkinID="TipoTelefone"></asp:DropDownList>
                 </td> 
                 <td>
                     <asp:Label ID="lblTelefone" runat="server" Text="Telefone:"></asp:Label>
                      
                      <asp:RequiredFieldValidator ID="rfvTel" runat="server" ControlToValidate="tbxTelefone"
                         ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                     </asp:RequiredFieldValidator>
                     <act:ValidatorCalloutExtender ID="rfvTel_ValidatorCalloutExtender" runat="server"
                         Enabled="True" TargetControlID="rfvTel">
                         </act:ValidatorCalloutExtender>
                         <br />
                     <asp:TextBox ID="tbxTelefone" runat="server" SkinID="Telefone"></asp:TextBox>
                     <act:MaskedEditExtender ID="tbxTelefone_MaskedEditExtender" runat="server" 
                         CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" SkinID="Fone"
                         CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                         CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                         TargetControlID="tbxTelefone">
                     </act:MaskedEditExtender>
                 </td>
                 <td>
                    <asp:Label ID="lblCelular" runat="server" Text="Celular:"></asp:Label>
                     
                      <asp:RequiredFieldValidator ID="rfvCel" runat="server" ControlToValidate="tbxCeluar"
                         ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                     </asp:RequiredFieldValidator>
                     <act:ValidatorCalloutExtender ID="rfvCel_ValidatorCalloutExtender" runat="server"
                         Enabled="True" TargetControlID="rfvCel">
                     </act:ValidatorCalloutExtender>
                      <br />
                     <asp:TextBox ID="tbxCeluar" runat="server" SkinID="Telefone"></asp:TextBox>
                     <act:MaskedEditExtender ID="tbxCeluar_MaskedEditExtender" runat="server" 
                         CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" SkinID="Fone"
                         CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                         CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                         TargetControlID="tbxCeluar">
                     </act:MaskedEditExtender>
                 </td>
                 <td>
                     <asp:Label ID="lblFax" runat="server" Text="Fax:"></asp:Label>
                     <br />
                     <asp:TextBox ID="tbxFax" runat="server" SkinID="Telefone"></asp:TextBox>
                     <act:MaskedEditExtender ID="tbxFax_MaskedEditExtender" runat="server" 
                         CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" SkinID="Fone"
                         CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                         CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" 
                         TargetControlID="tbxFax">
                     </act:MaskedEditExtender>
                 <td>
                     <asp:Label ID="lblEmail"  Text="Email:" runat="server"></asp:Label>
                     
                     <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ControlToValidate="tbxEmail"
                         ErrorMessage="Campo Obrigatório." ToolTip="Campo Obrigatório." ValidationGroup="Geral">
                     </asp:RequiredFieldValidator>
                     <act:ValidatorCalloutExtender ID="rfvEmail_ValidatorCalloutExtender" runat="server"
                         Enabled="True" TargetControlID="rfvEmail">
                     </act:ValidatorCalloutExtender>
                     <br />
                     <asp:TextBox ID="tbxEmail" runat="server" SkinID="Email"></asp:TextBox>
                </td>

              </tr>
           </table>
        </div>
        </asp:Panel>

        <asp:Panel ID="Panel1" runat="server">
              <table width="100%">
                            <tr>
                                <td style="width: 15%" align="right">
                                    <asp:Button ID="btnSalvar1" runat="server" Text="Concluir Cadastro" 
                                        ValidationGroup="Geral" />
                                    &nbsp;<asp:Button ID="btnCancelar" runat="server" SkinID="Cancelar" 
                                        onclick="btnCancelar_Click" />
                                </td>
                            </tr>
                        </table>
              
              </asp:Panel>
     </ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>

</asp:Content>
